<?php
/* @var $this SiteController */

$this->pageTitle='Settings - '.Yii::app()->name;
?>

<div class="panel panel-primary">
  <!-- Default panel contents -->
  <div class="panel-heading">Settings</div>
  <div class="panel-body">
 
<?php echo CHtml::errorSummary($model); ?>
<?php
echo CHtml::beginForm('','post',array('class'=>'form-horizontal','id'=>'settingForm')); 
?>

<?php /*
$this->widget('zii.widgets.jui.CJuiTabs',array(
    'tabs'=>array(
        'StaticTab 1'=>'Content for tab 1',
        'StaticTab 2'=>array('content'=>'Content for tab 2', 'id'=>'tab2'),
        // panel 3 contains the content rendered by a partial view
      
    ),
    // additional javascript options for the tabs plugin
    'options'=>array(
        'collapsible'=>true,
    ),
));*/
?>
<ul class="nav nav-tabs" id="site-settings">
<?php
 
$tabs = array();
$i = 0;
    foreach ($model->attributes as $category => $values):?>
        <li<?php echo !$i?' class="active"':''?>><a href="#<?php echo $category?>" data-toggle="tab"><?php echo ucfirst($category)?></a></li>
    <?php 
    $i ++;
    endforeach;?>
</ul>
    <div class="tab-content">
        <?php 
        $i = 0;
        foreach ($model->attributes as $category => $values):?>
            <div class="tab-pane<?php echo !$i?' active':''?>" id="<?php echo $category?>">
			
			<?php foreach ($values as $key => $val): ?>
    <br><div class="form-group">
        <?php echo CHtml::label($model->getAttributesLabels($key), $key, array('class'=>'col-sm-4 control-label')); ?>
        <?php 
        if($key === 'backup') {
            echo CHtml::checkBox(get_class($model) . '[' . $category . '][' . $key . ']', $val); 
        } else {
		echo '<div class="col-md-8";>';
			if( $key == 'google_analytics_code'){
				echo CHtml::textArea(get_class($model) . '[' . $category . '][' . $key . ']', $val, array('class'=>'input-xxlarge, form-control')); 
			} else {
				echo CHtml::textField(get_class($model) . '[' . $category . '][' . $key . ']', $val, array('class'=>'input-xxlarge, form-control')); 
			}
			echo '</div>';
		}
        ?>
        <?php echo CHtml::error($model, $category); ?>
    </div>
<?php endforeach; ?>
			
			
                <?php
                /* $this->renderPartial(
                        '_'.$category, 
                        array('model' => $model, 'values' => $values, 'category' => $category)
                    ); */
				
                ?>
            </div>
        <?php 
        $i ++;
        endforeach;?>
    </div>
	</div>
	 <div class="panel-footer" align="center">
<?php
echo CHtml::submitButton('Submit', array('class' => 'btn btn-info'));?>
</div>
<?php

echo CHtml::endForm();
?>

</div>
